import os,json
def main(data_path,predition_path):
    # with open(os.path.join(data_path, 'annotations.json')) as f:
    #     data_dict = json.load(f)
    with open(predition_path) as f:
        predition_dict = json.load(f)
    tar_split={
        'train':[],'val':[],'test':[]
    }
    for image_name in predition_dict:
        if predition_dict[image_name]==0:
            tar_split['train'].append(image_name)
        else:
            tar_split['test'].append(image_name)
    with open(os.path.join(data_path, 'split', 'ad.json'), 'w') as f:
        json.dump(tar_split, f)
if __name__ == '__main__':
    data_path = '/mnt/d/Workspace/MiniReti/'  
    predition_path = '../ROP_ridge_segmentation/prediction.json'
    main(data_path,predition_path)